package com.gopay.bis.web.controller.fund;

import java.io.UnsupportedEncodingException;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.gopay.common.constants.bank.BankConstants;
import com.gopay.common.domain.fund.vo.PageData;

/**
 * 中信基金服务入口
 * @CiticFundServerRes.java
 * @author dong-wang5@hnari.com
 * @2016年6月16日 上午10:58:58  www.gopay.com.cn Inc.All rights reserved.
 */
@Controller
@Scope("prototype")
public class CiticFundServerRes extends FundResBase {

	private static Log logger = LogFactory.getLog(CiticFundServerRes.class);

	@RequestMapping(value = "/allFront/PayingService")
	@ResponseBody
	public String execute(HttpServletRequest request) throws UnsupportedEncodingException {
		logger.info("中信银行基金支付联调接口入口！！！！！！" );
		request.setCharacterEncoding("UTF-8");
		PageData pageData = new PageData(request);
		logger.info("请求参数：" + ToStringBuilder.reflectionToString(pageData));
		//标记为中信银行监管
		pageData.put(BankConstants.BANK_LOGO_CITIC,BankConstants.BANK_LOGO_CITIC);
		//返回结果
		return super.execute(pageData);
	}
	@Override
	protected boolean checkBase(PageData pageData) {
		if(StringUtils.isEmpty(pageData.getString("sign"))){
			return false;
		}
		if(StringUtils.isEmpty(pageData.getString("sign_type"))){
			return false;
		}
		if(StringUtils.isEmpty(pageData.getString("service"))){
			return false;
		}
		return true;
	}
}
